Skip to content

Customer account rc doc - support doc generate #2768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

brianshen1990
Copy link
Contributor

@brianshen1990 brianshen1990 commented Apr 14, 2025

Background

Customer account rc version now supports doc generate.

Solution

Follow admin's behvaiour

🎩

Demo video: https://screenshot.click/15-01-yjwfa-6clit.mp4

Sorry Spin is not working anymore...

Checklist

  • I have 🎩'd these changes
  • I have updated relevant documentation

@brianshen1990 brianshen1990 changed the base branch from unstable to 2025-07-rc April 14, 2025 19:55
@brianshen1990 brianshen1990 force-pushed the customer-account-rc---support-doc-generate branch from 79048ab to 1b2c949 Compare April 15, 2025 15:52
@@ -0,0 +1,244 @@
/* eslint-disable no-undef, no-console */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the script re-usable and pass in the right paths instead of duplicating? It would be better for maintainance.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't copy paste this script. Bring it up layers and make it reusable for everyone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extracted all the shared functions, and let each service construct their own build steps

Copy link
Member

@alex-page alex-page Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great progress but I think there is more to do. The directory customer-account could be an argument passed into the CLI that would remove a lot of duplicate code. I think there is a lot of duplication that still should be consolidated. extensions api version should be shared...

I think we should really aim at making one script with arguments that works for all surfaces instead of splitting it into reusable functions. I understand the time pressure folks are under so I am willing to be flexible but I think this still needs a second pass.

"Provides information about the company of the authenticated business customer. The value is `undefined` if a business customer isn't authenticated.",
type: 'UseAuthenticatedAccountPurchasingCompanyGeneratedType',
},
// {
Copy link
Contributor Author

@brianshen1990 brianshen1990 Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing all the hooks for now, and will re-add them later once we have the hooks

@@ -5,7 +5,7 @@
"docs:admin": "node ./docs/surfaces/admin/build-docs.mjs",
"docs:checkout": "bash ./docs/surfaces/checkout/build-docs.sh",
"docs:point-of-sale": "bash ./docs/surfaces/point-of-sale/build-docs.sh",
"docs:customer-account": "bash ./docs/surfaces/customer-account/build-docs.sh"
"docs:customer-account": "node ./docs/surfaces/customer-account/build-docs.mjs"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

follow line 5 admin's behvaiour

@@ -0,0 +1,128 @@
export interface CustomerAccountActionProps {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy and combined from all the components' d.ts file for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no avatar for the 1st rc version

@@ -35,11 +35,6 @@ const data: ReferenceEntityTemplateSchema = {
codeblock: {
title: 'Basic CustomerAccountAction',
tabs: [
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all react examples for components as there is no ui-extensions-react

@@ -106,10 +106,6 @@ export interface CustomerAccountExtensionTargets {
FullPageApi,
StandardComponents
>;
'CustomerAccount::KitchenSink': RenderExtension<
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the test KitchenSink target

@brianshen1990 brianshen1990 force-pushed the customer-account-rc---support-doc-generate branch 3 times, most recently from aa5819d to 883ed8d Compare April 15, 2025 16:49
@brianshen1990 brianshen1990 self-assigned this Apr 15, 2025
@brianshen1990 brianshen1990 marked this pull request as ready for review April 15, 2025 16:51
@@ -0,0 +1,244 @@
/* eslint-disable no-undef, no-console */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the script re-usable and pass in the right paths instead of duplicating? It would be better for maintainance.

.replace(/&#039;/g, "'");
};

const htmlWrapper = (htmlString, layout) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this won't work for customer accounts. Maybe we should have a way to exclude previews. Thought @Fionoble @alex-page ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be renamed to adminHTMLWrapper and the templates below could be updated to include admin as well and use the adminHTMLWrapper. It's quite a simple adjustment but will ensure they can add their own templates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extracted some shared functions and make transformJson customizable 0459c0c

await fs.cp(generatedDocsPath, shopifyDevDBPath, {recursive: true});
};

const generateExtensionsDocs = async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should be brought into the admin docs generator and be named something with customer accounts name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extracted some shared functions and make transformJson customizable 0459c0c

Copy link
Member

@alex-page alex-page left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great prototype but we should consolidate here instead of duplicate 90% of the work. Happy to support the consolidation but it's likely just adding prefixes to ensure docs do not overlap and have clear functions for each area.

rootPath,
generatedDocsDataFile,
generatedStaticPagesFile,
transformJson: (filePath) => transformJson(filePath, true),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now this is an optional function, admin will pass it

outputDir,
rootPath,
generatedDocsDataFile,
transformJson: (filePath) => transformJson(filePath, false),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not pass generatedStaticPagesFile here so that generateFiles will know do not replace non-existing static json file

@@ -0,0 +1,72 @@
/* eslint-disable no-undef, no-console */
import childProcess from 'child_process';
import fs from 'fs/promises';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all extracted from admin's buold-docs scripts. All these functions will only use parameters, no global variables any more

replaceValue: '',
});

if (transformJson) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transformJson become optional

@brianshen1990
Copy link
Contributor Author

brianshen1990 commented Apr 16, 2025

Hey @alex-page and @vividviolet , I

  • moved all non doc generation scripts into another PR so that this will be much easier to review;
  • and extracted some shared functions and make transformJson customizable

can you help to give another review? thanks

example test video here https://screenshot.click/15-56-qwuux-c1885.mp4

@brianshen1990 brianshen1990 changed the title Customer account rc support doc generate Customer account rc doc - support doc generate Apr 16, 2025
@brianshen1990 brianshen1990 force-pushed the customer-account-rc---support-doc-generate branch from 1fc0607 to a61ae38 Compare April 16, 2025 04:37
@brianshen1990 brianshen1990 changed the base branch from 2025-07-rc to customer-account-rc-doc---remove-react-examples April 16, 2025 04:38
@alex-page alex-page dismissed their stale review April 16, 2025 04:43

Good progress. I think more should be done but folks are racing for deadlines.

Copy link
Contributor

@oluwatimio oluwatimio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as it looks good on my end. I guess there's still some concerns about sharing as much logic as possible. We can look to improve the script even more, although not sure how deep we want to go into that for this PR

@sylvhama sylvhama removed their request for review April 16, 2025 20:52
@brianshen1990 brianshen1990 merged commit 69c63db into customer-account-rc-doc---remove-react-examples Apr 17, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants